using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;

namespace Sysgeprava.Repository.Mapping
{
    public class TEL_VETERINARIOMap : EntityTypeConfiguration<TEL_VETERINARIO>
    {
        public TEL_VETERINARIOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.NumTelefono)
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("TEL_VETERINARIO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdOperador).HasColumnName("IdOperador");
            this.Property(t => t.IdVeterinario).HasColumnName("IdVeterinario");
            this.Property(t => t.NumTelefono).HasColumnName("NumTelefono");

            // Relationships
            this.HasOptional(t => t.OPERADOR)
                .WithMany(t => t.TEL_VETERINARIO)
                .HasForeignKey(d => d.IdOperador);
            this.HasRequired(t => t.VETERINARIO)
                .WithMany(t => t.TEL_VETERINARIO)
                .HasForeignKey(d => d.IdVeterinario);

        }
    }
}
